﻿@model ECatalog.Models.Locations.LocationViewModel
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Location</title>
    @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/bootstrap/base")
    <script src="~/Scripts/jquery-1.4.2.min.js"></script>
    <script src="~/Scripts/jquery-ui-1.8.6.custom.min.js"></script>
    <script src="~/Scripts/jquery-watermarker-0.3.js"></script>
    <script type="text/javascript">
        //<!--
        $().ready(function () {
            $('#watermarked').Watermarker({
                watermark_img: '../../Content/img/marker.png',
                onChange: showCoords,
                x: parseInt(@Model.LocationX),
                y: parseInt(@Model.LocationY),
                text: '@Model.CatNumber'
            });
        });
        function showCoords(c) {
            $('#x').val(c.x);
            $('#y').val(c.y);
        };
        //-->
    </script>
    <style type="text/css">
        div.watermark:hover {
            cursor: move;
        }
    </style>
</head>
<body>
    @{
        Html.RenderPartial("NavBar",Model.User);
    }
    <div style="position: absolute;left:250px;top:105px;">
        @if (Model != null)
        {
            using (@Html.BeginForm("SaveLocation", "Model", null, FormMethod.Post))
            {
            <input type="hidden" id="x" name="x" value="@Model.LocationX" />
            <input type="hidden" id="y" name="y" value="@Model.LocationY" />
            @Html.HiddenFor(m => m.ModelId)
            @Html.HiddenFor(m => m.ShopId)
               
                var imageUrl = "";
                if (Model != null)
                {
                    imageUrl = string.Format("/Files/Organization-{0}/Shop-{1}/{2}/800x600/{3}{4}", @Model.OrganizationId, @Model.ShopId, @Model.MapUrl, @Model.MapUrl,@Model.TypeImage);
                }

            <div>
                <img class="photo-location-block" src="@imageUrl" alt="" id="watermarked"  />
            </div>
            <br />
            <div>
                <input type="submit" value="Сохранить" class="btn btn-primary" />
                @Html.ActionLink("Отмена", "EditModel", "Model", new { modelid = Model.ModelId }, null)
            </div>
            }
        }
    </div>
</body>
</html>
